﻿using System;
using System.Windows.Forms;

namespace Texpro
{
    public partial class FMMN106 : Form
    {
        
        public FMMN106()
        {
            InitializeComponent();
            this.UseWaitCursor = false; 
        }

        private void FMAD201_Load(object sender, EventArgs e)
        {
            lbl_caption.Text = PCMSG.m_caption.ToString();
            lbl_text.Text = PCMSG.m_text.ToString();
            switch (PCMSG.m_icon)
            {
                case MessageBoxIcon.Information:
                    pb_icon.Image = il_icon.Images["information"];
                    break;
                case MessageBoxIcon.Question:
                    pb_icon.Image = il_icon.Images["question"];
                    break;
                case MessageBoxIcon.Warning:
                    pb_icon.Image = il_icon.Images["warning"];
                    break;
                case MessageBoxIcon.Error:
                    pb_icon.Image = il_icon.Images["error"];
                    break;
                default:
                    pb_icon.Image = il_icon.Images["information"];
                    break;
            }
            but_button1.Visible = false;
            but_button2.Visible = false;
            switch (PCMSG.m_buttons)
            {
                case MessageBoxButtons.OKCancel:
                    but_button1.Text = Properties.Resources.BUT_OK_TEXT.ToString();
                    but_button1.DialogResult = DialogResult.OK;
                    but_button1.Left = 145;
                    but_button2.Text = "Cancel";
                    but_button2.DialogResult = DialogResult.Cancel;
                    but_button2.Left = 255;
                    but_button1.Visible = true;
                    but_button2.Visible = true;
                    break;
                case MessageBoxButtons.YesNo:
                    but_button1.Text = "Yes";
                    but_button1.DialogResult = DialogResult.Yes;
                    but_button1.Left = 145;
                    but_button2.Text = "No";
                    but_button2.DialogResult = DialogResult.No;
                    but_button2.Left = 255;
                    but_button1.Visible = true;
                    but_button2.Visible = true;
                    break;
                default:
                    but_button1.Text = Properties.Resources.BUT_OK_TEXT.ToString();
                    but_button1.DialogResult = DialogResult.OK;
                    but_button1.Left = 200;
                    but_button2.Text = "Cancel";
                    but_button2.DialogResult = DialogResult.Cancel;
                    but_button2.Left = 200;
                    but_button1.Visible = true;
                    but_button2.Visible = false;
                    break;
            }
            switch (PCMSG.m_default)
            {
                case MessageBoxDefaultButton.Button1:
                    but_button1.TabIndex = 0;
                    but_button2.TabIndex = 1;
                    break;
                case MessageBoxDefaultButton.Button2:
                    but_button1.TabIndex = 1;
                    but_button2.TabIndex = 0;
                    break;
                default:
                    but_button1.TabIndex = 0;
                    but_button2.TabIndex = 1;
                    break;
            }
        }

        private void but_button1_Click(object sender, EventArgs e)
        {
            PCMSG.m_result = but_button1.DialogResult;
            this.Close();
        }

        private void but_button2_Click(object sender, EventArgs e)
        {
            PCMSG.m_result = but_button2.DialogResult;
            this.Close();
        }
 
    }

}